<?php defined('IN_IA') or exit('Access Denied');?><!doctype html>
<html lang=zh class=digimon>
<head>
<meta charset=utf-8>
<meta name=keywords content="">
<meta name=description content="">
<meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate">
<meta http-equiv=Pragma content=no-cache><meta http-equiv=Expires content=0>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php  echo $sets['title'];?></title>
<meta name=screen-orientation content=portrait>
<meta name=full-screen content=yes><meta name=x5-orientation content=portrait>
<meta name=x5-fullscreen content=true>
<meta name=msapplication-tap-highlight content=no>
<link rel="stylesheet" href="<?php  echo MODULE_URL;?>template/mobile/css/digimon-new.css?t=f33reg">
</head>
<body>
	<div style="display: none;">
		<img src="<?php  echo $userInfo['headimgurl'];?>">
	</div>
	<a class="button disabled" href=#>下一题</a>
	<div class=wrapper>
		<?php  if(is_array($list)) { foreach($list as $item) { ?>
		<?php  if($item['type']=="picture"){ ?>
		<div class="page type-2 <?php  if($item['qid']=='1'){echo 'active';}?>" id=page-<?php  echo $item['qid'];?>>
			<div class=main>
				<div class=question>
					<span class=num><?php  echo $item['qid'];?></span>
					<span class=text><?php  echo $item['question'];?></span>
				</div>
				<ul class="options clearfix">
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_a'];?>></figure>
						<p><?php  echo $item['pic_a_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_b'];?>></figure>
						<p><?php  echo $item['pic_b_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_c'];?>></figure>
						<p><?php  echo $item['pic_c_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_d'];?>></figure>
						<p><?php  echo $item['pic_d_intro'];?></p>
					</li>
				</ul>
			</div>
		</div>
		<?php  }else{ ?>
		<div class="page type-text <?php  if($item['qid']=='1'){echo 'active';}?>" id=page-<?php  echo $item['qid'];?>>
			<div class=main>
				<div class=question>
					<span class=num><?php  echo $item['qid'];?></span>
					<span class=text><?php  echo $item['question'];?></span>
				</div>
				<ul class="options clearfix">
					<li><p>A. <?php  echo $item['ans_a'];?></p></li>
					<li><p>B. <?php  echo $item['ans_b'];?></p></li>
					<li><p>C. <?php  echo $item['ans_c'];?></p></li>
					<li><p>D. <?php  echo $item['ans_d'];?></p></li>
				</ul>
			</div>
		</div>
		<?php  } ?>
		<?php  } } ?>
		
		<div class=page id=page-not>
			<div class=main>
				<h3>下面是最后一题，也是最重要的一题...</h3>
				<div class=fox></div>
			</div>
		</div>

		<?php  if(is_array($last_one)) { foreach($last_one as $item) { ?>
		<?php  if($item['type']=="picture"){ ?>
		<div class="page type-2 <?php  if($item['qid']=='1'){echo 'active';}?>" id=page-<?php  echo $item['qid'];?>>
			<div class=main>
				<div class=question>
					<span class=num><?php  echo $item['qid'];?></span>
					<span class=text><?php  echo $item['question'];?></span>
				</div>
				<ul class="options clearfix">
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_a'];?>></figure>
						<p><?php  echo $item['pic_a_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_b'];?>></figure>
						<p><?php  echo $item['pic_b_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_c'];?>></figure>
						<p><?php  echo $item['pic_c_intro'];?></p>
					</li>
					<li>
						<figure><img src=<?php  echo $_W['attachurl'];?><?php  echo $item['pic_d'];?>></figure>
						<p><?php  echo $item['pic_d_intro'];?></p>
					</li>
				</ul>
			</div>
		</div>
		<?php  }else{ ?>
		<div class="page type-text <?php  if($item['qid']=='1'){echo 'active';}?>" id=page-<?php  echo $item['qid'];?>>
			<div class=main>
				<div class=question>
					<span class=num><?php  echo $item['qid'];?></span>
					<span class=text><?php  echo $item['question'];?></span>
				</div>
				<ul class="options clearfix">
					<li><p>A. <?php  echo $item['ans_a'];?></p></li>
					<li><p>B. <?php  echo $item['ans_b'];?></p></li>
					<li><p>C. <?php  echo $item['ans_c'];?></p></li>
					<li><p>D. <?php  echo $item['ans_d'];?></p></li>
				</ul>
			</div>
		</div>
		<?php  } ?>
		<?php  } } ?>
		<div class=page id=page-share>
			<div class=content>
				<div class=geek></div>
				<div class=wrap>
					<div class=headimg><img src="<?php  echo $userInfo['headimgurl'];?>"></div>
					<div class=score>
						<div class=line></div>
						<div class=text id=score>0</div>
					</div>  
					<p id=praise></p>
					<h4>在微信中关注“<?php  echo $_W['uniaccount']['name'];?>”，回复“<?php  echo $sets['copyright'];?>”，可收到测试题答案。</h4>
				</div>
			</div>
			<div class=share>- 欢迎分享给你的朋友 -</div>
			<div class="rank content">
				<table>
					<tr><th></th><th>积分排行榜</th><th></th></tr>
					<tr><td><img src="<?php  echo $userInfo['headimgurl'];?>"></td><td><?php  echo $userInfo['nickname'];?></td><td>20分</td></tr>
					<tr><td><img src="<?php  echo $userInfo['headimgurl'];?>"></td><td><?php  echo $userInfo['nickname'];?></td><td>20分</td></tr>
					<tr><td><img src="<?php  echo $userInfo['headimgurl'];?>"></td><td><?php  echo $userInfo['nickname'];?></td><td>20分</td></tr>
				</table>
			</div>
			<div class="adv">
				<a href=<?php  echo $this->createMobileUrl('egg');?>><img src="<?php  echo $_W['attachurl'];?><?php  echo $sets['adv'];?>"></a>
			</div>
		</div>
	</div>
	<script src="<?php  echo MODULE_URL;?>template/mobile/js/digimon-new-lib.js"></script>
	<script src="<?php  echo MODULE_URL;?>template/mobile/js/digimon-new-app.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(e) {
	var total=<?php  echo $total;?>;
	var cent = Math.round(100/total);
	var ans_json=<?php  echo json_encode($answer);?>;
	var result_json=<?php  echo json_encode($result);?>;
	function roundReloaded(num, dec) {
            var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
            return result;
    }
    var t = {
        scoreText: result_json,
        duration: 400,
        answer: ans_json
    },
    n = {
        questionList: [],
        currIndex: 0,
        isRunning: !1,
        isWeixin: function() {
            var e = navigator.userAgent.toLowerCase();
            return "micromessenger" == e.match(/MicroMessenger/i) ? !0 : !1
        },

        getScore: function() {
            for (var e = this,
            n = 0,
            rcount = 0,
            i = t.scoreText[0].praise, s = t.scoreText[0].weixin1, r = !1, a = 0; a < e.questionList.length; a++) {
                var o = e.questionList[a];
                null != o.select && o.select + "" == o.answer + "" && (rcount += 1)
            }
            n=roundReloaded(rcount / total * 100,2);
            return n >= 10 && 31 > n ? (i = t.scoreText[1].praise, s = t.scoreText[1].weixin1 + n + t.scoreText[1].weixin2) : n >= 40 && 60 >= n ? (i = t.scoreText[2].praise, s = t.scoreText[2].weixin1 + n + t.scoreText[2].weixin2) : n >= 70 && 90 >= n ? (i = t.scoreText[3].praise, s = t.scoreText[3].weixin1 + n + t.scoreText[3].weixin2) : 100 === n && (i = t.scoreText[4].praise, s = t.scoreText[4].weixin1, r = !0),
            {
                score: n,
                praise: i,
                weixin: s,
                geek: r
            }
        },
        pageContent: function() {
            var n = this;
            n.currIndex < n.questionList.length && (n.currIndex < total-1 && e(".fox").removeClass("active"), total-2 == n.currIndex ? (e(".button").html("最后一题"), setTimeout(function() {
                e(".fox").addClass("active")
            },
            t.duration + 10), setTimeout(function() {
                e(".button").removeClass("disabled")
            },
            t.duration + 2030)) : total-1 == n.currIndex ? e(".button").html("完成") : n.currIndex == n.questionList.length - 2 && (e("#score").html(n.getScore().score), e("#praise").html(n.getScore().praise), e("title").html(n.getScore().weixin), e(".button").css({
                display: "none"
            }), n.getScore().geek && setTimeout(function() {
                e("#page-share .geek").addClass("active")
            },
            t.duration + 600)))
        },
        next: function() {
            var n = this;
            e(".button").hasClass("disabled") || n.isRunning || (n.isRunning = !0, setTimeout(function() {
                n.isRunning = !1
            },
            t.duration + 100), n.currIndex < n.questionList.length && (n.questionList[n.currIndex + 1].element.addClass("active"), n.questionList[n.currIndex].element.addClass("aminated"), e(".button").addClass("disabled"), n.pageContent(), n.currIndex - 1 >= 0 && setTimeout(function() {
                n.questionList[n.currIndex - 1].element.removeClass("active").css({
                    display: "none"
                })
            },
            t.duration + 10), n.currIndex++, n.currIndex < n.questionList.length - 1 && n.questionList[n.currIndex + 1].element.css({
                display: "block"
            })))
        },
        init: function() {
            var n = e(".page"),
            i = this;
            if (n && n.length > 0) {
                e(n[1]).css({
                    display: "block"
                }),
                e("#praise").html(i.getScore().praise),
                i.questionList = [];
                for (var s = n.length - 1; s >= 0; s--) {
                    var r = e(n[s]);
                    i.questionList[s] = {
                        element: r,
                        point: cent,
                        answer: t.answer[r.attr("id")],
                        select: null
                    }
                }
                e(document).on("tap",
                function(t) {
                    if (e(t.target).closest(".options").length > 0) {
                        var n = e(t.target).closest("li"),
                        s = n.index();
                        e(t.target).closest("li").addClass("selected").siblings("li").removeClass("selected"),
                        i.questionList[i.currIndex].select = s,
                        e(t.target).closest(".page").find(".selected").length > 0 && e(".button").removeClass("disabled")
                    }
                })
            }
            e(document).on("touchend click", ".button",
            function() {
                return i.next(),
                !1
            })
        }
    };
    n.init()
    e(".adv").on('tap',function(){ 
    	window.location.href="<?php  echo $this->createMobileUrl('egg');?>";
    })
});
</script>

</body>
</html>